package com.dundun.pattern.abstractfactory.factory.table;

import com.dundun.pattern.abstractfactory.factory.Item;
import com.dundun.pattern.abstractfactory.factory.Page;

public class TablePage extends Page {

    public TablePage(String title, String author) {
        super(title, author);
    }

    @Override
    public String makeHTML() {
        StringBuilder sb = new StringBuilder();
        sb.append("<html><head><title>").append(title).append("</title></head>\n");
        sb.append("<body>\n");
        sb.append("<h1>").append(title).append("</h1>\n");
        sb.append("<ul>\n");
        for(Item it : content) {
            sb.append(it.makeHTML());
        }
        sb.append("</ul>\n");
        sb.append("<hr><address>").append(author).append("</address></body></html>");
        return sb.toString();
    }
}
